<template>
    <div>
        sm2加密
    </div>
</template>
<script lang='ts' setup>

import {sm2,sm3,sm4} from 'sm-crypto'
let prvivateKey="48eec1b286d379f474908662b5d7711e7774e927a28e0f3f50323f91c91a4bf0";
//公钥一般都是 调接口返回
let publicKey="04c874b606ef4a15521ecc592187701d6fc2279dff4cbc9fb79d0978fd88d4a70ec05de2401b2360dea044a2cdbac52e4087cd11339bc8141a1a331e1a2558b89e";
 
let pwd="admin";

//加密
let pwd2=sm2.doEncrypt(pwd,publicKey);

console.log("加密字符串",pwd2);

//解密

let pwd3=sm2.doDecrypt(pwd2,prvivateKey);

console.log("解密字符串",pwd3);



 


</script>
<style scoped>
</style>